Flash memory is a type of nonvolatile storage device. Flash memory provides easy and fast information storage/retrieval in such devices as digital cameras, cellular phones, digital camcorders. Flash memory devices utilize EEPROM technology for the memory arrays, where EEPROM stands for Electrically Erasable Programmable Read Only Memory. Due to the achievable capacity and speed of accessing data, flash memory is commonly used in electronic devices that handle multimedia data.
In operation flash memory devices need to be erased before they can be written with new data. The finest granularity of erasure, known as an erase block, is typically much larger than the finest granularity for a read/write operation, also referred to as a sector. To write a single sector, the adjacent sectors in the erase block have to be recycled as well. If an erase block comprises NE sectors, then a single block write to a sector N involves the erase block whose first sector is N0=(N div NE)*NE and is logically performed as follows;                (1) read sectors N0 to N0+NE−1        (2) clear erase block        (3) replace sector N read in step (1) with new data        (4) write sectors N0 to N0+NE−1        
If the system loses power during this write procedure, not only is sector N not written, but the sectors around sector N may also be corrupted as well. This can result in damage, i.e. data loss and/or corruption, in a file system which is implemented on a flash memory device.
One solution according to the prior art comprises repairing a damaged file system. This approach results in the loss of a large number of files if damage occurs to the file system's inode table. If a directory file is damaged or lost, then access is lost to all files below the damaged directory file, and they become orphans.
Another known solution in the art comprises file system journaling. The journaling is effective to handle writes which are not completed, but is not effective at finding corruption in data blocks that have been written. These corrupted data blocks may arise even though the transaction is shown as being successfully completed.
Accordingly, there remains a need for techniques for dealing with data on read/write memory devices such as flash disk devices.